﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using OpenWings.Entities;

namespace OpenWings.UI.Controls
{
    public partial class PropertiesView : UserControl
    {
        public event EventHandler Collapse;

        public PropertiesView()
        {
            InitializeComponent();
        }

        public object Entity
        {
            set 
            { 
                PropertiesGrid.SelectedObject = value;

                if (value is Client)
                    TitleToolStripLabel.Text = "Client properties";
                else if (value is Server)
                    TitleToolStripLabel.Text = "Server properties";
                else
                    TitleToolStripLabel.Text = "Properties";
            }
        }

        private void CloseToolStripButton_Click(object sender, EventArgs e)
        {
            if (Collapse != null)
                Collapse(this, EventArgs.Empty);
        }
    }
}
